package com.tenglong.teacher.ui.register;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.cuotibao.zhuoxiao.basics.GlobalConstant;
import com.tenglong.teacher.R;
import com.tenglong.teacher.ui.common.activity.BaseActivity;

public class RegisterActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        findViewById(R.id.personRegister).setOnClickListener(this);
        findViewById(R.id.companyRegister).setOnClickListener(this);
        setTitle("选择机构");
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case R.id.personRegister:
                startActivityForResult(new Intent(this, PersonRegisterActivity.class), GlobalConstant.REQUEST_CODE_PERSON_REGISTER_ACTIVITY);
                break;
            case R.id.companyRegister:
                startActivity(new Intent(this, CompanyRegisterActivity.class));
                break;
        }
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (resultCode == Activity.RESULT_OK) {
            switch (requestCode) {
                case GlobalConstant.REQUEST_CODE_PERSON_REGISTER_ACTIVITY:
                    if (data != null) {
                        setResult(Activity.RESULT_OK, data);
                        finish();
                    }
                    break;
            }
        }
    }
}
